package com.xiaozhichao.javaapi.designpattern.observer.model.userdefined;

public class User implements Observer {

    private String name;
    private String message;

    public User(String name) {
        this.name = name;
    }

    @Override
    public void update(Object obj) {
        this.message = String.valueOf(obj);
        read();
    }

    private void read() {
        System.out.println(name + " 收到推送消息： " + message);
    }

}
